<?php

class Model_ZendDb_Paginator_SearchCategory extends Zend_Paginator_Adapter_DbSelect
{
    public function __construct(Zend_Db_Select $select)
    {
        parent::__construct($select);
    }
    
    /**
     * @param $offset
     * @param $itemCountPerPage
     * @return array of Model_Entity_Category
     */
    public function getItems($offset, $itemCountPerPage) {
        $resultSet = parent::getItems($offset, $itemCountPerPage);
        
        $entries = array();
        foreach ($resultSet as $row) {
            $entries[] = new Model_Entity_Category($row);
        }
        
        return $entries;
    }
    
    /**
     * Returns the total number of rows in the result set.
     *
     * @return integer
     */
    public function count()
    {
        return parent::count();
    }
}
